/**
 * 类装饰器可以扩展类的功能，比如添加新的方法和属性
 * 构造函数接口类型的的字面量形式写法： {new (...args: any[]): {}}
 */

function addTimeStamp<T extends { new (...args: any[]): {} }>(constructor: T) {
  return class extends constructor {
    timeStamp = new Date();
  };
}

@addTimeStamp
class Document {
  constructor(public title: string) {}
}
const doc = new Document('My Document')
console.log(doc.title);
console.log(doc);


export {};
